<template>
  <el-input v-model="title" placeholder="请输入标题" @keydown.enter="addItem"></el-input>
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";
@Options({
  props: {
    addL: {
      type: Function,
      required: true
    }
  }
})
export default class Test extends Vue {
  addL!: Function;
  title: string = "";
  public addItem(): void {
    if (this.title.trim()) {
      let obj = {
        id: Date.now(),
        title: this.title,
        isCheck: false
      };
      this.addL(obj);
      this.title = "";
    }
  }
}
</script>

<style lang="less" scoped>
</style>
